package com.bnzjy.srb.core.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * <p>
 * 用户基本信息
 * </p>
 *
 * @author Helen
 * @since 2021-12-13
 */
@Data
@Valid
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="UserInfo对象", description="用户基本信息")
public class UserInfo implements Serializable {

    private static final long serialVersionUID = 1L;
    
    public static final Integer STATUS_NORMAL = 1;
    
    public static final Integer STATUS_LOCKED = 0;

    @ApiModelProperty(value = "编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "1：出借人 2：借款人")
    private Integer userType;

    @NotEmpty
    @Length(min = 11, max = 11, message = "手机号的长度为 11位")
    @Pattern(regexp = "^((13[0-9])|(15[^4,\\D])|(17[0-9])|(18[0-9]))\\d{8}$", message = "手机格式有误，请输入正确的手机号")
    @ApiModelProperty(value = "手机号")
    private String mobile;
    
    @NotNull
    @Length(min = 6, max = 32)
    @Pattern(regexp = "^(?![0-9] + $)(?![a-zA-Z] + $)[0-9A-Za-z]{6,24}$", message = "密码必须为6-24个字母和数字组合")
    @ApiModelProperty(value = "用户密码")
    private String password;

    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    @NotEmpty
    @ApiModelProperty(value = "用户姓名")
    private String name;
    
    @NotNull
    @Length(min = 18)
    @Pattern(regexp = "^(\\d{18,18}|\\d{15,15}|(\\d{17,17}[x|X]))$", message="身份证格式错误")
    @Length(max = 18, message = "身份证号为 18位")
    @ApiModelProperty(value = "身份证号")
    private String idCard;
    
    @Email(message = "邮箱格式错误")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "微信用户标识openid")
    private String openid;

    @ApiModelProperty(value = "头像")
    private String headImg;

    @ApiModelProperty(value = "绑定状态（0：未绑定，1：绑定成功 -1：绑定失败）")
    private Integer bindStatus;

    @ApiModelProperty(value = "借款人认证状态（0：未认证 1：认证中 2：认证通过 -1：认证失败）")
    private Integer borrowAuthStatus;

    @ApiModelProperty(value = "绑定账户协议号")
    private String bindCode;

    @ApiModelProperty(value = "用户积分")
    private Integer integral;

    @ApiModelProperty(value = "状态（0：锁定 1：正常）")
    private Integer status;
    
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "逻辑删除(1:已删除，0:未删除)")
    @TableField("is_deleted")
    @TableLogic
    private Boolean deleted;


}
